﻿using Exam.infrastructure.Dto.Response;
using System;
using System.Collections.Generic;
using System.Text;

namespace Exam.Service.Instance
{
    /// <summary>
    /// 基础服务类 
    /// </summary>
    public abstract class Base_Service
    {

        public Api_Result GetResult(int result,string message="",object data=null)
        {
            Api_Code code = Api_Code.ok;
            if (result <= 0)
            {
                code = Api_Code.fail;
            }
            string msg = result > 0 ? "操作成功" : "操作失败";
            if (!string.IsNullOrEmpty(message))
            {
                msg = message;
            }
            return new Api_Result()
            {
                code = code,
                message = msg,
                data = data
            };

        }
    }
}
